package com.sss.gsb.orm.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
@Table(name = "GSB_WS_LOAN_ACC")
public class Loan implements Serializable {
	
	@Transient
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Transient
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Loan other = (Loan) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 7527692616634752924L;
	
	@ManyToOne
	@JoinColumn(name="CIF")
	private Customer customer;
	
	@OneToMany(mappedBy="loan",cascade=CascadeType.ALL)
	private Set<LoanAccountClosed> loanAccountClosed;
	
	@Id @Column(name="CID")
	private BigDecimal id;
	
	@Column(name="OPEN_DATE")
	private Date openDate;
	
	@Column(name="STAT")
	private Integer stat ;
	
	@Column(name="FIRST_DFP")	
	@Temporal(TemporalType.DATE)
	private Date firstDeposit;

	@Column(name="NEXT_SCHND")	
	@Temporal(TemporalType.DATE)
	private Date nextSchedual;

	@Column(name="LAST_CHLD")	
	@Temporal(TemporalType.DATE)
	private Date lastSchedual;
	
	@Column(name="PRINCIPAL")
	private BigDecimal pricipal;
	
	@Column(name="BAL")
	private BigDecimal balance;
	
	@Column(name="BRCD")
	private Integer branchId  ;
	
	@Column(name="BRCD_NAME")
	private String branchName;
	
	@Column(name="REG")
	private Integer regionId  ;
	
	@Column(name="REG_NAME")
	private String regionName;
	
	@Column(name="DIST")
	private Integer distinctId ;
	
	@Column(name="DIST_NAME")
	private String distrinctName;
	
	@Column(name="MKTCD")
	private Integer productMarketTypeId  ;
	
	@Column(name="MKTCD_NAME")
	private String productMarketTypeName;
	
	@Column(name="PROJCODE")
	private String projectCode;
	
	@Column(name="PAYMENT_DTNT")
	@Temporal(TemporalType.DATE)
	private Date paymentDate;
	
	@Column(name="PAMT")
	private BigDecimal paymentAmount;
	
	@Column(name="GTDUE")
	private BigDecimal GTDue;
	
	@Column(name="OSEQ")
	private BigDecimal OSeq;
	
	@Column(name="AMOMDT")
	@Temporal(TemporalType.DATE)
	private Date AMOMDT;
	
	@Column(name="MAX_OND")
	private BigDecimal maxOND;
	
	@Column(name="SIGN_DTNT")
	@Temporal(TemporalType.DATE)
	private Date signDTNT;
	
	@Column(name="CLOSE_DTNT")
	@Temporal(TemporalType.DATE)
	private Date closeDTNT;
	
	@Embedded RecordInfo recordInfo;

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public BigDecimal getId() {
		return id;
	}

	public void setId(BigDecimal id) {
		this.id = id;
	}

	public Date getOpenDate() {
		return openDate;
	}

	public void setOpenDate(Date openDate) {
		this.openDate = openDate;
	}

	public Integer getStat() {
		return (stat ==null)?0:stat;
	}

	public void setStat(Integer stat) {
		this.stat = stat;
	}

	public Date getFirstDeposit() {
		return firstDeposit;
	}

	public void setFirstDeposit(Date firstDeposit) {
		this.firstDeposit = firstDeposit;
	}

	public Date getNextSchedual() {
		return nextSchedual;
	}

	public void setNextSchedual(Date nextSchedual) {
		this.nextSchedual = nextSchedual;
	}

	public Date getLastSchedual() {
		return lastSchedual;
	}

	public void setLastSchedual(Date lastSchedual) {
		this.lastSchedual = lastSchedual;
	}

	public BigDecimal getPricipal() {
		return pricipal;
	}

	public void setPricipal(BigDecimal pricipal) {
		this.pricipal = pricipal;
	}

	public BigDecimal getBalance() {
		return balance;
	}

	public void setBalance(BigDecimal balance) {
		this.balance = balance;
	}

	public Integer getBranchId() {
		return (branchId == null)?0:branchId;
	}

	public void setBranchId(Integer branchId) {
		this.branchId = branchId;
	}

	public String getBranchName() {
		return branchName;
	}

	public void setBranchName(String branchName) {
		this.branchName = branchName;
	}

	public Integer getRegionId() {
		return (regionId == null)?0:regionId;
	}

	public void setRegionId(Integer regionId) {
		this.regionId = regionId;
	}

	public String getRegionName() {
		return regionName;
	}

	public void setRegionName(String regionName) {
		this.regionName = regionName;
	}

	public Integer getDistinctId() {
		return (distinctId == null)?0:distinctId;
	}

	public void setDistinctId(Integer distinctId) {
		this.distinctId = distinctId;
	}

	public String getDistrinctName() {
		return distrinctName;
	}

	public void setDistrinctName(String distrinctName) {
		this.distrinctName = distrinctName;
	}

	public Integer getProductMarketTypeId() {
		return (productMarketTypeId == null)?0:productMarketTypeId;
	}

	public void setProductMarketTypeId(Integer productMarketTypeId) {
		this.productMarketTypeId = productMarketTypeId;
	}

	public String getProductMarketTypeName() {
		return productMarketTypeName;
	}

	public void setProductMarketTypeName(String productMarketTypeName) {
		this.productMarketTypeName = productMarketTypeName;
	}

	public String getProjectCode() {
		return projectCode;
	}

	public void setProjectCode(String projectCode) {
		this.projectCode = projectCode;
	}

	public Date getPaymentDate() {
		return paymentDate;
	}

	public void setPaymentDate(Date paymentDate) {
		this.paymentDate = paymentDate;
	}

	public BigDecimal getPaymentAmount() {
		return paymentAmount;
	}

	public void setPaymentAmount(BigDecimal peymentAmount) {
		this.paymentAmount = peymentAmount;
	}

	public BigDecimal getGTDue() {
		return GTDue;
	}

	public void setGTDue(BigDecimal gTDue) {
		GTDue = gTDue;
	}

	public BigDecimal getOSeq() {
		return OSeq;
	}

	public void setOSeq(BigDecimal oSeq) {
		OSeq = oSeq;
	}

	public Date getAMOMDT() {
		return AMOMDT;
	}

	public void setAMOMDT(Date aMOMDT) {
		AMOMDT = aMOMDT;
	}

	public BigDecimal getMaxOND() {
		return maxOND;
	}

	public void setMaxOND(BigDecimal maxOND) {
		this.maxOND = maxOND;
	}

	public Date getSignDTNT() {
		return signDTNT;
	}

	public void setSignDTNT(Date signDTNT) {
		this.signDTNT = signDTNT;
	}

	public Date getCloseDTNT() {
		return closeDTNT;
	}

	public void setCloseDTNT(Date closeDTNT) {
		this.closeDTNT = closeDTNT;
	}

	public RecordInfo getRecordInfo() {
		return recordInfo;
	}

	public void setRecordInfo(RecordInfo recordInfo) {
		this.recordInfo = recordInfo;
	}

	public void setLoanAccountClosed(Set<LoanAccountClosed> loanAccountClosed) {
		this.loanAccountClosed = loanAccountClosed;
	}

	public Set<LoanAccountClosed> getLoanAccountClosed() {
		return loanAccountClosed;
	}
	
	
}
